<!DOCTYPE html>
<html>
<head>
    <title>${Application.site_name.content}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="${Application.site_description.content}">
    <meta name="description" content="${Application.site_keywords.content}">
    <meta name="apple-mobile-web-app-capable" content="no">
    <meta content="True" name="HandheldFriendly">
    <link rel="shortcut icon" href="/img/favicon.png" type="image/png"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstraApplication.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/css/bootstrap-flat.css">
    <link href="//cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.css" rel="stylesheet">
    <link href="//cdn.bootcss.com/dropzone/4.2.0/min/dropzone.min.css" rel="stylesheet">
    <script src="//cdn.bootcss.com/jquery/2.1.0/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstraApplication.min.js"></script>
    <script src="/js/apApplication.min.js"></script>
    <script type="text/javascript">
	function count(){
		$.getJSON("/notifications/count",function (msg){
				if(msg!=$("#notification-count").html()){
					$("#notification-count").html(msg);
				}
		});
	}
		setInterval(count,45000);

    </script>
</head>

<body>
<nav class="navbar  navbar-static-top navbar-default">
    <div class="container">
        <div class="navbar-header">
            <a href="/" class="navbar-brand">${Application.site_name.content}</a>
        </div>
        <span>
			<ul class="nav navbar-nav">
				${Application.nav_main.content}
			</ul>
					<#if Session.user ?exists>
						<ul class="nav navbar-nav user-bar navbar-right">
					<li class="notification-count"><a href="/topics/create"
                                                      class="" title="发表新话题"><span
                            class="glyphicon glyphicon-pencil"></span></a></li>
						<li class="notification-count"><a href="/notifications"
                                                          class="" title="通知"><span
                                class="glyphicon glyphicon-bell"></span> <strong id="notification-count">0</strong></a> </li>
						<li class="dropdown"><a href="#" class="dropdown-toggle"
                                                data-toggle="dropdown" role="button" aria-expanded="false">
							<span class="glyphicon glyphicon-user" aria-hidden="true"></span> ${Session.user.nick}
								<span class="caret"></span>
						</a>
							<button class="navbar-toggle" type="button"
                                    data-toggle="dropdown" role="button" aria-expanded="false">
								<span class="sr-only">Toggle</span>
							</button>
							<ul class="dropdown-menu" role="menu">
								<li class="">
								<a href="/users/${Session.user.id}/topics">
								<span class="glyphicon glyphicon-home" aria-hidden="true"></span> 我的主页</a>
								</li>
								<li class="">
								<a href="/account/setting"><span class="glyphicon glyphicon-cog"></span> 个人设置</a>
								</li>
								<li class="">
								<a href="/users/${Session.user.id}/collections">
								<span class="glyphicon glyphicon-bookmark"></span> 收藏话题</a>
								</li>
								<li class="">
								<a href="/users/${Session.user.id}/following">
								<span class="glyphicon glyphicon-asterisk"></span> 我所关注</a>
								</li>
							<#if Session.user.role == Application.comment_edit.content>
								<li class=""><div class="divider"></div></li>
								<li class="">
								<a href="/back/">
								<span class="glyphicon glyphicon-cloud"></span> 后台管理</a>
							</li>
							</#if>
								<li class=""><div class="divider"></div></li>
								<li class=""><a rel="nofollow" data-method="delete"
                                                href="/account/signout">
									<span class="glyphicon glyphicon-off"></span> 退出</a></li>
							</ul></li>
					</ul>
				<#else>
					<ul class="nav navbar-nav navbar-right">
						<li><a href="/account/signin"><span class="glyphicon glyphicon-log-in"></span> 登陆</a></li>
						<li><a href="/account/signup"><span class="glyphicon glyphicon-user"></span> 注册</a></li>
					</ul>
				</#if>
		</span>
    </div>
</nav>
